#ifndef __SWM241_PORT_H__
#define __SWM241_PORT_H__

void PORT_Init(PORT_TypeDef * PORTx, uint32_t n, uint32_t func, uint32_t digit_in_en);


#define PORTA_PIN0_GPIO		 	0
#define PORTA_PIN0_SPI0_SSEL	1
#define PORTA_PIN0_UART1_RX		2
#define PORTA_PIN0_HALL_IN2		3
#define PORTA_PIN0_SLED_COM4	4

#define PORTA_PIN1_GPIO			0
#define PORTA_PIN1_I2C1_SCL		1
#define PORTA_PIN1_SPI0_SCLK	2
#define PORTA_PIN1_PWM_BRK1		3
#define PORTA_PIN1_SLED_COM5	4

#define PORTA_PIN2_GPIO			0
#define PORTA_PIN2_I2C1_SDA		1
#define PORTA_PIN2_SPI0_MISO	2
#define PORTA_PIN2_UART2_TX		3
#define PORTA_PIN2_SLED_COM6	4

#define PORTA_PIN3_GPIO			0
#define PORTA_PIN3_I2C0_SCL		1
#define PORTA_PIN3_SPI1_SSEL	2
#define PORTA_PIN3_PWM1A		3
#define PORTA_PIN3_TIMR2_IN		4
#define PORTA_PIN3_TIMR2_OUT	5
#define PORTA_PIN3_SLED_SEG11	6
#define PORTA_PIN3_SLCD_SEG18	15
#define PORTA_PIN3_ADC_IN11		0

#define PORTA_PIN4_GPIO			0
#define PORTA_PIN4_UART0_TX		1
#define PORTA_PIN4_PWM1AN		2
#define PORTA_PIN4_TIMR7_IN		3
#define PORTA_PIN4_TIMR7_OUT	4
#define PORTA_PIN4_SLCD_SEG19	15

#define PORTA_PIN5_GPIO			0
#define PORTA_PIN5_UART0_RX		1
#define PORTA_PIN5_UART0_TX		2
#define PORTA_PIN5_PWM0BN		3

#define PORTA_PIN6_GPIO			0
#define PORTA_PIN6_PWM_CLK0		1
#define PORTA_PIN6_SLCD_SEG20	15

#define PORTA_PIN7_GPIO			0
#define PORTA_PIN7_SPI1_SSEL	1
#define PORTA_PIN7_UART2_RTS	2
#define PORTA_PIN7_SLED_SEG12	3
#define PORTA_PIN7_SLCD_SEG9	15
#define PORTA_PIN7_ADC_IN7		0

#define PORTA_PIN8_GPIO		 	0
#define PORTA_PIN8_UART2_CTS	1
#define PORTA_PIN8_SLED_SEG13	2
#define PORTA_PIN8_SLCD_SEG10	15
#define PORTA_PIN8_ADC_IN6		0

#define PORTA_PIN9_GPIO			0
#define PORTA_PIN9_PWM0B		1
#define PORTA_PIN9_SLED_SEG14	2
#define PORTA_PIN9_SLCD_SEG11	15
#define PORTA_PIN9_ADC_IN5		0

#define PORTA_PIN10_GPIO		0
#define PORTA_PIN10_SWCLK		1
#define PORTA_PIN10_TIMR7_IN	2
#define PORTA_PIN10_TIMR7_OUT	3
#define PORTA_PIN10_SLED_SEG15	4
#define PORTA_PIN10_SLCD_SEG12	15
#define PORTA_PIN10_ADC_IN4		0

#define PORTA_PIN11_GPIO		0
#define PORTA_PIN11_SWDIO		1
#define PORTA_PIN11_PWM3A		2
#define PORTA_PIN11_SLED_SEG16	3
#define PORTA_PIN11_SLCD_SEG13	15
#define PORTA_PIN11_ADC_IN3		0

#define PORTA_PIN12_GPIO		0
#define PORTA_PIN12_TIMR6_IN	1
#define PORTA_PIN12_TIMR6_OUT	2
#define PORTA_PIN12_SLCD_SEG14	15
#define PORTA_PIN12_ADC_IN2		0

#define PORTA_PIN13_GPIO		0
#define PORTA_PIN13_PWM3B		1
#define PORTA_PIN13_ADC_IN1		15

#define PORTA_PIN14_GPIO		0
#define PORTA_PIN14_SPI0_SCLK	1
#define PORTA_PIN14_PWM3AN		2
#define PORTA_PIN14_ADC_IN0		15

#define PORTA_PIN15_GPIO		0
#define PORTA_PIN15_PWM3BN		1


#define PORTB_PIN0_GPIO		 	0
#define PORTB_PIN0_SPI1_MOSI	1
#define PORTB_PIN0_UART3_TX		2
#define PORTB_PIN0_PWM2A		3
#define PORTB_PIN0_TIMR2_IN		4
#define PORTB_PIN0_TIMR2_OUT	5
#define PORTB_PIN0_SLCD_SEG31	15

#define PORTB_PIN1_GPIO			0
#define PORTB_PIN1_SPI1_MISO	1
#define PORTB_PIN1_UART3_RX		2
#define PORTB_PIN1_PWM2B		3
#define PORTB_PIN1_TIMR1_IN		4
#define PORTB_PIN1_TIMR1_OUT	5
#define PORTB_PIN1_SLED_SEG0	6
#define PORTB_PIN1_SLCD_SEG0	15

#define PORTB_PIN2_GPIO			0
#define PORTB_PIN2_I2C0_SCL		1
#define PORTB_PIN2_SPI0_SCLK	2
#define PORTB_PIN2_PWM3B		3
#define PORTB_PIN2_TIMR2_IN		4
#define PORTB_PIN2_TIMR2_OUT	5
#define PORTB_PIN2_SLED_SEG1	6
#define PORTB_PIN2_SLCD_SEG1	15

#define PORTB_PIN3_GPIO			0
#define PORTB_PIN3_I2C0_SDA		1
#define PORTB_PIN3_I2C1_SCL		2
#define PORTB_PIN3_SPI0_MISO	3
#define PORTB_PIN3_UART2_RX		4
#define PORTB_PIN3_PWM3BN		5
#define PORTB_PIN3_TIMR3_IN		6
#define PORTB_PIN3_TIMR3_OUT	7
#define PORTB_PIN3_SLED_SEG2	8
#define PORTB_PIN3_SLCD_SEG2	15

#define PORTB_PIN4_GPIO			0
#define PORTB_PIN4_I2C1_SDA		1
#define PORTB_PIN4_SPI0_MOSI	2
#define PORTB_PIN4_UART2_TX		3
#define PORTB_PIN4_CAN_TX		4
#define PORTB_PIN4_PWM2BN		5
#define PORTB_PIN4_TIMR4_IN		6
#define PORTB_PIN4_TIMR4_OUT	7
#define PORTB_PIN4_SLED_SEG3	8
#define PORTB_PIN4_SLCD_SEG3	15

#define PORTB_PIN5_GPIO			0
#define PORTB_PIN5_SWCLK		1
#define PORTB_PIN5_SPI1_MOSI	2
#define PORTB_PIN5_UART3_TX		3
#define PORTB_PIN5_CAN_RX		4
#define PORTB_PIN5_PWM2AN		5
#define PORTB_PIN5_TIMR5_IN		6
#define PORTB_PIN5_TIMR5_OUT	7
#define PORTB_PIN5_SLED_SEG4	8
#define PORTB_PIN5_SLCD_SEG4	15

#define PORTB_PIN6_GPIO			0
#define PORTB_PIN6_SWDIO		1
#define PORTB_PIN6_I2C1_SDA		2
#define PORTB_PIN6_SPI1_MISO	3
#define PORTB_PIN6_UART3_RX		4
#define PORTB_PIN6_TIMR6_IN		5
#define PORTB_PIN6_TIMR6_OUT	6
#define PORTB_PIN6_SLED_SEG5	7
#define PORTB_PIN6_SLCD_SEG5	15

#define PORTB_PIN7_GPIO			0
#define PORTB_PIN7_I2C1_SCL		1
#define PORTB_PIN7_SPI1_SCLK	2
#define PORTB_PIN7_TIMR7_IN		3
#define PORTB_PIN7_TIMR7_OUT	4
#define PORTB_PIN7_SLED_SEG6	5
#define PORTB_PIN7_SLCD_SEG6	15

#define PORTB_PIN8_GPIO		 	0
#define PORTB_PIN8_UART1_TX		1
#define PORTB_PIN8_SLCD_SEG7	15

#define PORTB_PIN9_GPIO			0
#define PORTB_PIN9_UART1_RX		1
#define PORTB_PIN9_SLED_SEG7	2
#define PORTB_PIN9_SLCD_SEG8	15
#define PORTB_PIN9_ADC_IN8		0


#define PORTC_PIN0_GPIO		 	0
#define PORTC_PIN0_SPI0_MOSI	1
#define PORTC_PIN0_UART2_RX		2
#define PORTC_PIN0_PWM2BN		3
#define PORTC_PIN0_SLED_COM7	4
#define PORTC_PIN0_SLCD_SEG24	15

#define PORTC_PIN1_GPIO			0
#define PORTC_PIN1_SPI1_MOSI	1
#define PORTC_PIN1_PWM2B		2
#define PORTC_PIN1_TIMR5_OUT	3
#define PORTC_PIN1_SLED_SEG17	4
#define PORTC_PIN1_SLCD_SEG25	15

#define PORTC_PIN2_GPIO			0
#define PORTC_PIN2_I2C0_SDA		1
#define PORTC_PIN2_SPI1_MISO	2
#define PORTC_PIN2_TIMR5_IN		3
#define PORTC_PIN2_SLED_SEG18	4
#define PORTC_PIN2_SLCD_SEG26	15

#define PORTC_PIN3_GPIO			0
#define PORTC_PIN3_I2C0_SCL		1
#define PORTC_PIN3_SPI1_SCLK	2
#define PORTC_PIN3_PWM2AN		3
#define PORTC_PIN3_TIMR1_IN		4
#define PORTC_PIN3_TIMR1_OUT	5
#define PORTC_PIN3_SLED_SEG19	6
#define PORTC_PIN3_SLCD_SEG27	15


#define PORTD_PIN0_GPIO		 	0
#define PORTD_PIN0_UART0_RTS	1
#define PORTD_PIN0_PWM0AN		2
#define PORTD_PIN0_SLCD_SEG21	15

#define PORTD_PIN1_GPIO			0
#define PORTD_PIN1_UART0_CTS	1
#define PORTD_PIN1_PWM0A		2
#define PORTD_PIN1_WAKEUP		15
#define PORTD_PIN1_SLCD_SEG22	15

#define PORTD_PIN2_GPIO			0
#define PORTD_PIN2_XTAL_IN		15

#define PORTD_PIN3_GPIO			0
#define PORTD_PIN3_PWM_CLK1		1
#define PORTD_PIN3_XTAL_OUT		15

#define PORTD_PIN4_GPIO			0
#define PORTD_PIN4_I2C0_SCL		1
#define PORTD_PIN4_HALL_IN1		2
#define PORTD_PIN4_SLCD_SEG23	15

#define PORTD_PIN5_GPIO			0
#define PORTD_PIN5_I2C0_SDA		1
#define PORTD_PIN5_HALL_IN2		2
#define PORTD_PIN5_SLCD_COM0	15

#define PORTD_PIN6_GPIO			0
#define PORTD_PIN6_I2C0_SCL		1
#define PORTD_PIN6_UART1_RTS	2
#define PORTD_PIN6_CAN_TX		3
#define PORTD_PIN6_PWM_BRK0		4
#define PORTD_PIN6_HALL_IN0		5
#define PORTD_PIN6_SLED_COM0	6
#define PORTD_PIN6_SLCD_COM1	15

#define PORTD_PIN7_GPIO			0
#define PORTD_PIN7_I2C0_SDA		1
#define PORTD_PIN7_UART1_CTS	2
#define PORTD_PIN7_CAN_RX		3
#define PORTD_PIN7_PWM2AN		4
#define PORTD_PIN7_SLED_COM1	5
#define PORTD_PIN7_SLCD_COM2	15

#define PORTD_PIN8_GPIO			0
#define PORTD_PIN8_PWM2A		1
#define PORTD_PIN8_HALL_IN0		2
#define PORTD_PIN8_TIMR3_IN		3
#define PORTD_PIN8_TIMR3_OUT	4
#define PORTD_PIN8_SLED_COM2	5
#define PORTD_PIN8_SLCD_COM3	15

#define PORTD_PIN9_GPIO			0
#define PORTD_PIN9_UART1_TX		1
#define PORTD_PIN9_HALL_IN1		2
#define PORTD_PIN9_TIMR3_IN		3
#define PORTD_PIN9_TIMR3_OUT	4
#define PORTD_PIN9_SLED_COM3	5

#define PORTD_PIN10_GPIO		0
#define PORTD_PIN10_I2C1_SCL	1
#define PORTD_PIN10_SPI0_SCLK	2
#define PORTD_PIN10_PWM2B		3
#define PORTD_PIN10_RTC_1HZ		4
#define PORTD_PIN10_SLCD_SEG28	15

#define PORTD_PIN11_GPIO		0
#define PORTD_PIN11_I2C1_SDA	1
#define PORTD_PIN11_SPI0_MISO	2
#define PORTD_PIN11_UART3_RX	3
#define PORTD_PIN11_PWM2A		4
#define PORTD_PIN11_SLCD_SEG29	15

#define PORTD_PIN12_GPIO		0
#define PORTD_PIN12_SPI0_MOSI	1
#define PORTD_PIN12_UART3_TX	2
#define PORTD_PIN12_PWM2B		3
#define PORTD_PIN12_TIMR4_IN	4
#define PORTD_PIN12_TIMR4_OUT	5
#define PORTD_PIN12_SLCD_SEG30	15

#define PORTD_PIN13_GPIO		0
#define PORTD_PIN13_I2C0_SDA	1
#define PORTD_PIN13_SPI0_MISO	2
#define PORTD_PIN13_UART0_RX	3
#define PORTD_PIN13_TIMR0_OUT	4
#define PORTD_PIN13_SLED_SEG8	5
#define PORTD_PIN13_SLCD_SEG15	15
#define PORTD_PIN13_ADC_IN9		0

#define PORTD_PIN14_GPIO		0
#define PORTD_PIN14_SPI0_MOSI	1
#define PORTD_PIN14_UART0_TX	2
#define PORTD_PIN14_PWM1BN		3
#define PORTD_PIN14_TIMR0_IN	4
#define PORTD_PIN14_SLED_SEG9	5
#define PORTD_PIN14_SLCD_SEG16	15
#define PORTD_PIN14_ADC_IN10	0

#define PORTD_PIN15_GPIO		0
#define PORTD_PIN15_SPI0_SSEL	1
#define PORTD_PIN15_PWM1B		2
#define PORTD_PIN15_TIMR0_IN	3
#define PORTD_PIN15_TIMR0_OUT	4
#define PORTD_PIN15_SLED_SEG10	5
#define PORTD_PIN15_SLCD_SEG17	15


#endif //__SWM241_PORT_H__
